/*  This file is part of the comicconquer project
    Copyright (C) 2010 Reach <reach334@gmail.com>

    ComicConquer is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public 
    License along with this software.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef ZIPCONTAINER_H
#define ZIPCONTAINER_H

#include "mist.h"
#include "unzip.h"
#include "ioapi.h"

class ZipContainer
{
    //-- constructor and destructor
public:
    ZipContainer(const QString& zipFileName);
    ~ZipContainer();

    //-- public memthods
public:
    QImage* getImage(int id);
    bool isEmpty();
    int count();
    QString& zipFileName();
    void reOpen();

    //-- private methods
private:
    bool openZipFile();
    void generateList();
    QByteArray* extractFile(int id);

    //-- private members
private:
    QString m_zipFileName;
    unzFile m_uf;
    QVector<unz64_file_pos> m_posVec;
    bool m_havePic;
};

#endif // ZIPCONTAINER_H
